import '../../app_files.dart';
import 'model/main_view_model.dart';
import 'banner_component/state.dart';
import 'package:fish_redux/fish_redux.dart';

class MainViewState implements GlobalBaseState<MainViewState> {
  MainViewModel model;

  ///0 安检领导 1 安检员 2 维修员 3 巡检员
  int type;

  /// 1安检统计 2 巡检统计
  int checkLeaderType = 1;

  CountLeaderModel countModel;
  int sortIndex = 0;

  bool multipleSelect = false;
  List selectItems = [];

  InstallModel installModel;

  List items;
  bool itemLoaded = false;
  int currentPage = 1;

  bool isGsUser;

  List<BannerModel> banners = [
    BannerModel(
        imgUrl:
            'https://www.crcgas.com/index/banner/201901/W020190125650052758341.jpg'),
  ];

  EasyRefreshController refreshController = EasyRefreshController();
  @override
  UserInfoEntity userInfo;

  @override
  MainViewState clone() {
    return MainViewState()
      ..userInfo = userInfo
      ..model = model
      ..countModel = countModel
      ..items = items
      ..sortIndex = sortIndex
      ..currentPage = currentPage
      ..type = type
      ..multipleSelect = multipleSelect
      ..selectItems = selectItems
      ..refreshController = refreshController
      ..isGsUser = isGsUser
      ..checkLeaderType = checkLeaderType
      ..itemLoaded = itemLoaded
      ..installModel = installModel;
  }
}

MainViewState initState(Map<String, dynamic> args) {
  return MainViewState();
}

class BannerComponentCon extends ConnOp<MainViewState, BannerComponentState> {
  @override
  BannerComponentState get(MainViewState state) {
    final BannerComponentState reportState = BannerComponentState()
      ..list = state.banners;
    return reportState;
  }

  @override
  void set(MainViewState state, BannerComponentState substate) {}
}
